<div class="loader"></div>
<h3>{{ $text_edit }} {{ $title }} with ID# {{ $result->id }}</h3>
{{ Form::model($result, array('route' => array($base . '.update', $result->id), 'method' => 'PUT', 'id' => 'form')) }}
	<div class="form-group">
		{{ Form::label('name', $form_name) }}
		{{ Form::text('name', Input::old('name'), array('class' => 'form-control')) }}
		<span class="error text-danger" id="error_name"></span>
	</div>

	<div class="form-group">
		{{ Form::label('level', $form_level) }}
		{{ Form::select('level', $levels, Input::old('level'), array('class' => 'form-control')) }}
		<span class="error text-danger" id="error_level"></span>
	</div>	

	<div class="form-group">
		{{ Form::label('name', $form_permission) }}
		<table class="table table-bordered">
			<thead>
				<tr>
					<th>{{ $text_module }}</th>
					<th>{{ $text_route }}</th>
					<th>{{ $text_create }}</th>
					<th>{{ $text_read }}</th>
					<th>{{ $text_update }}</th>
					<th>{{ $text_delete }}</th>
				</tr>
			</thead>
			<tbody id="user_profile">
			@foreach( $modules as $index=>$module )
				<tr>
					<td>{{ $module['title'] }}
						{{ Form::hidden('user_permission[' . $index . '][title]', $module['title']) }}
					</td>
					<td>{{ $module['route'] }} 
						{{ Form::hidden('user_permission[' . $index . '][route]', $module['route']) }}
					</td>
					<td align="center">{{ Form::checkbox('user_permission[' . $index . '][create]', true, $module['create']) }}</td>
					<td align="center">{{ Form::checkbox('user_permission[' . $index . '][read]', true, $module['read']) }}</td>
					<td align="center">{{ Form::checkbox('user_permission[' . $index . '][update]', true, $module['update']) }}</td>
					<td align="center">{{ Form::checkbox('user_permission[' . $index . '][delete]', true, $module['delete']) }}</td>
				</tr>
			@endforeach
			</tbody>
		</table>
		<span class="error text-danger" id="error_user_permission"></span>
	</div>

	{{ Form::submit($text_submit, array('class' => 'btn btn-primary', 'id'=> 'submit', 'data-loading-text' => $text_loading)) }}
	{{ HTML::link( URL::previous(), $text_cancel, array('class' => 'btn btn-default', 'id'=> 'cancel')) }}
{{ Form::close() }}
